<?php
class Admin extends CI_Controller{
    function __construct() {
        parent::__construct();
        $this->load->model('model_user');
        $this->load->model('model_soal');
        $this->load->model('model_nilai');
        if($this->model_user->auth() == 0 || $this->model_user->auth() !== 1){
            redirect('login/index');
        }else{
            if($this->session->userdata('type') == 'guru'){
                redirect('guru');
            }else if($this->session->userdata('type') == 'siswa'){
                redirect('siswa');
            }
        }
    }
    function index(){
        $data['nama'] = $this->session->userdata['nama'];
        $data['main_content'] = 'admin/index';
        $this->load->view('includes/template',$data);
    }
    
    function nilai(){
        $data['query'] = $this->model_soal->getSoalAdmin();
        $data['main_content'] = 'admin/nilai';
        $this->load->view('includes/template', $data);
    }
    
    function daftarnilai($id){
        $data['nilais'] = $this->model_nilai->getDaftarNilai($id);
        $data['main_content'] = 'admin/daftar_nilai';
        $this->load->view('includes/template', $data);
    }
}
?>
